const rp = require('request-promise-native');

async function fetchMovie(item) {
    const url = 'http://api.douban.com/v2/movie/subject/1764796';
    const res = await rp(url);
    return res;
}
;(async () => {
    let movies = [
        {
            doubanId: 27166442,
            title: '夏目友人帐',
            rate: 8,
            poster: 'https://img1.doubanio.com/view/photo/l_ratio_poster/public/p2546745948.jpg'
        },
        {
            doubanId: 27031237,
            title: '玻璃先生',
            rate: 6.4,
            poster: 'https://img1.doubanio.com/view/photo/l_ratio_poster/public/p2541258858.jpg'
        }
    ];
    movies.map(async item => {
        let movieData = await fetchMovie(item);
        try{
            movieData = JSON.parse(movieData);
            console.log(movieData.tags);
            console.log(movieData.summary);
        } catch (err) {
            console.log(err)
        }
    })
})();